using Dapper;
using KL.Standard.Domain.Repositories;
using KL.Standard.Model.Infrastructure;
using KL.Standard.Model.Models.BaseArch;
using KL.Standard.Repositories.MutliDataSource;

namespace KL.Standard.Repositories.BaseArch;

public class OpeLogRepository: BaseRepository<SysOperationLogPO, ECPDataSource>, IOpeLogRepository
{
    public int writeLog(string loginId, string controllerName, string actionName, string path, string requestStr,
        string empty)
    {
        string vSql = @"
                INSERT INTO [dbo].[sys_operation_log]
           ([userID]
           ,[loginID]
           ,[menuID]
           ,[module]
           ,[reqUrl]
           ,[opeType]
           ,[oldValue]
           ,[newValue]
           ,[createdTime])
            values
            (@userID,@loginID,0,@module,@reqUrl,@opeType,@oldValue,@newValue,getdate());
            ";
        return this.DbConn.Execute(vSql, new
        {
            userID = 0,
            loginID = loginId,
            module = controllerName,
            reqUrl = path,
            opeType = actionName,
            newValue = requestStr,
            oldValue = empty

        });
    }
}